package com.simonall.service.impl;

import java.util.Date;
import java.util.UUID;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.simonall.member.model.User;
import com.simonall.service.SystemLogService;
import com.simonall.service.TestBusService;
import com.simonall.service.UserService;

@Service(value = "recordService")
public class TestBusServiceImpl implements TestBusService {
	
	@Resource
	private UserService userService;
	
	@Resource
	private SystemLogService systemLogService;

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void create() {
		User user = new User();
		user.setCreateTime(new Date());
		user.setNickName(UUID.randomUUID().toString());
		user.setUserName(UUID.randomUUID().toString());
		userService.save(user);
		
		// throw new RuntimeException("抛出异常");
		
//		SystemLog systemLog = new SystemLog();
//		systemLog.setCreateTime(new Date());
//		systemLog.setIp("192.168.0.1");
//		systemLog.setRequestUrl("/index.html");
//		systemLogService.save(systemLog);
		
		// throw new RuntimeException("抛出异常");
	}
	
	
	
}
